import React, { useEffect, useState } from 'react';
import localDb from '@/utils/localDB';

const r = ['64feec8ae6de3ece9c58b57f', '64feec8ae6de3ece9c58b581'];

const AuthWrapper = (props) => {
  const { children } = props;
  const [role, setRole] = useState('');
  useEffect(() => {
    const userInfo: any = localDb.get('userInfo');
    setRole(userInfo.role);
  }, []);
  return <>{r.includes(role) ? children : null}</>;
};

export default AuthWrapper;
